#include <stdio.h>
int main()
{
    char dest[10][1024];
    int n;
    const char* s ;

    s = "Hello world";
    n = sscanf(s, "%s%s", dest[0], dest[1]);
    printf("n = %d, dest[0] = <%s>, dest[1] = <%s>\n", n, dest[0], dest[1]);

    s = "Hello world";
    n = sscanf(s, "%[^ ] %s", dest[0], dest[1]);
    printf("n = %d, dest[0] = <%s>, dest[1] = <%s>\n", n, dest[0], dest[1]);

    s = "Hello world\r\n";
    n = sscanf(s, "%[^ ] %[^\r]", dest[0], dest[1]);
    printf("n = %d, dest[0] = <%s>, dest[1] = <%s>\n", n, dest[0], dest[1]);

    s = "Hello:world\r\n";
    n = sscanf(s, "%[^:]:%s", dest[0], dest[1]);
    printf("n = %d, dest[0] = <%s>, dest[1] = <%s>\n", n, dest[0], dest[1]);


    s = "GET /root/path.txt HTTP/1.0\r\n";
    n = sscanf(s, "%10[^ ] %s HTTP/%[^\r]*", dest[0], dest[1], dest[2]);
    printf("n = %d, dest[0] = <%s>, dest[1] = <%s>, dest[2] = <%s>\n", n, dest[0], dest[1], dest[2]);

    return 0;
}
